/************************************************************
https://anotherssisframework.codeplex.com

Copyright (c) 2014, Allen J. Zyck <sql.architect@outlook.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights 
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
 to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


************************************************************/

/***********

File: ConnectEnvToParams.sql

Description:
This is a sql template used to link .

After creating the SSISFrameworkCommon environment, this script links the Environment variables to the project parameters.

***********/


Declare @reference_id bigint
EXEC [SSISDB].[catalog].[create_environment_reference] @environment_name=N'SSISFrameworkCommon', @reference_id=@reference_id OUTPUT, @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @reference_type=R
Select @reference_id

GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'ConfigDB_InitialCatalog', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'ConfigDB Database Name'
GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'ConfigDB_ServerName', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'ConfigDB Instance Name'
GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'DataWarehouse_InitialCatalog', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'Data Warehouse Database Name'
GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'DataWarehouse_ServerName', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'Data Warehouse Instance Name'
GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'ErrorGettingLineage_FromLine', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'SMTP Package Failure From Line'
GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'ErrorGettingLineage_ToLine', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'SMTP Package Failure To Line'
GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'FailedConnectionMailNotification_FromLine', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'SMTP Package Failure From Line'
GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'FailedConnectionMailNotification_ToLine', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'SMTP Package Failure To Line'
GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'History_InitialCatalog', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'HistoryDB Database Name'
GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'History_ServerName', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'HistoryDB Instance Name'
GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'SMTP_SmtpServer', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'SMTP Server Name'
GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'SendFailureEMail_FromLine', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'SMTP Package Failure From Line'
GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'SendFailureEMail_ToLine', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'SMTP Package Failure To Line'
GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'SendSuccessEMail_FromLine', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'SMTP Package Success From Line'
GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'SendSuccessEMail_ToLine', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'SMTP Package Success To Line'
GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'Staging_InitialCatalog', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'StagingDB Database Name'
GO
EXEC [SSISDB].[catalog].[set_object_parameter_value] @object_type=20, @parameter_name=N'Staging_ServerName', @object_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @folder_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @project_name=N'<SSISDB Folder/Project, sysname, SSIS Project Name>', @value_type=R, @parameter_value=N'StagingDB Instance Name'
GO


